package priv.pattern.factory.staticFactory;

import priv.pattern.factory.staticFactory.abs.Mooncakes;
import priv.pattern.factory.staticFactory.abs.impl.Beansand;
import priv.pattern.factory.staticFactory.abs.impl.FiveKernel;

/*
 * 作者：m鹏h
 * 时间；2024/7/30 17:34
 * 描述：月饼的工厂类 （用反射优化月饼工厂类）
 **/
public class MooncakesFactory {
 public static <T extends Mooncakes> T makeMooncakes(Class<T> clz) {
  Mooncakes mooncakes = null;
  try {
   mooncakes = (Mooncakes) Class.forName(clz.getName()).newInstance();
  } catch (Exception e) {
   e.printStackTrace();
  }
  return (T) mooncakes;
 }

}
